﻿   @model Telerik.Web.Mvc.GridModel<Loja.DataDTO.PedidoDTO>
@using Telerik.Web.Mvc.UI

  @{
      int gridPageSize = 10;
      
   }

   <div><a href="javascript:Novo();"><img src="@Url.Content("~/Content/Images/crud/add.png")" title="Novo Pedido" /></a></div><br />

    <table>
    <tr>
        <td>
            @(Html.Telerik().Grid<Loja.DataDTO.PedidoDTO>(Model.Data)
                    .Name("Pedidos")
                    .Columns(columns =>
                    {
                        columns.Bound(p => p.CodigoPedido);
                       
                        columns.Bound(p => p.NomeCliente)
                           .Width("250px");

                        columns.Bound(p => p.ValorTotal)
                          .Width("250px");
                        
                        columns.Bound(p => p.Data)
                           .Width("200px");
                        
                        columns.Bound(p => p.DscStatus)
                        .Width("200px");
                        
                        columns.Bound(p => p.IdPedido)
                            .Width(50)
                            .Template(p => Ajax.ActionLink("Editar", "Editar", new { idPedido = p.IdPedido }, new AjaxOptions { UpdateTargetId = "conteudo", HttpMethod = "get", InsertionMode = InsertionMode.Replace}));
                            
                    })
                    .Pageable(settings => settings.Total(Model.Total).PageSize(gridPageSize).Position(GridPagerPosition.Bottom))
                            .DataBinding(dataBinding => dataBinding.Ajax().Select("Listar", "Pedido"))
                    .EnableCustomBinding(true))
                    
        </td>
    </tr>
</table>

